<?php

namespace App\Http\Middleware;

use Closure;

use function App\Webdisk\makeRes;

class AuthAdmin
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $user = $request->attributes->get("user");
        if($user == null || $user->type != 1){
            return response(makeRes(-1,null,"权限不足"));
        }else{
            return $next($request);
        }
    }
}
